<template>
    <h2>用户投资明细</h2>
    <table class="table table-bordered">
        <thead>
            <tr style="background-color: cyan">
                <th>投资人登录账号</th>
                <th>投资金额</th>
                <th>投资时间</th>
            </tr>
        </thead>
        <tbody>
            <tr v-for="item in info">
                <td>{{ item.UL_Name }}</td>
                <td>{{ item.UI_Money }}</td>
                <td>{{ item.UI_date.substring(0, 10)}}</td>
            </tr>
        </tbody>
    </table>
    <button @click="ret">返回</button>
</template>

<script setup lang="ts">
import { useRouter, useRoute } from 'vue-router'
import { ref, onMounted } from 'vue';
import axios from 'axios';


const router = useRouter()
const route = useRoute()
const info = ref([{
    UL_Name: '',
    UI_Money: 0,
    UI_date: '',
    I_Id: 0,
}])

onMounted(() => {
    loadData();
})
//加载数据
function loadData() {
    axios.get("https://localhost:44387/api/Invests/ShowAllUserInvestInfo", {
        params: {
            Iid: route.query.Iid,
        }
    })
        .then(function (response) {
            console.log(response.data)
            info.value = response.data
        })
}

const ret=()=>{
    router.push('/ShowUserInvestDetail')
}

</script>
